package com.wbw.ssb.exception;



import com.wbw.ssb.common.api.ResultCode;
import lombok.Getter;
import lombok.Setter;

/**
 * @Author: guibo
 * @Description: API异常类
 * @Date: Created in 21:05 2021/1/11
 * @Modified By:
 */
@Getter
@Setter
public class ApiException extends RuntimeException {
    int code;
    String message;


    public ApiException(String message) {
        super(message);
        this.message = message;
        this.code = 500;
    }

    public ApiException(Throwable cause) {
        super(cause);
    }

    public ApiException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApiException(ResultCode resultCode) {
        this.code = (int) resultCode.getCode();
        this.message = resultCode.getMessage();
    }
    public ApiException(String message,ResultCode resultCode) {
        this.code = (int) resultCode.getCode();
        this.message = message;
    }
}
